﻿function OnClickLogin() {
    var userName = $("#txtLoginName").val();
    var userPsw = $("#txtLoginPwd").val();

    if (!userPsw || !userName) {
        alert("帐号或密码不能为空!");
        return;
    }
    $("#btnLogin").text("登录中...").attr("disabled", true);
    $.post("/Login.aspx", "txtLoginName=" + userName + "&txtLoginPwd=" + userPsw, function (e) {
        if (-1 < e.indexOf("ok")) {
            location.href = "/union/" + e.split('_')[1];
        }
        else {
            $("#btnLogin").text("登录").attr("disabled", false);
            alert(e);
        }
    });
}

$(document).keyup(function (event) {
    if (event.keyCode == 13) {
        OnClickLogin();
    }
});